package question.T0125_1_Hero;

// 在一个游戏系统中，物理伤害的计算公式是 总攻击力*(1+增伤)-敌方防御，魔法伤害的计算公式是 总攻击力*(1+法术强度)
// 战士造成物理伤害，总攻击力为自身的攻击力 +40（装备的攻击力）
// 法师造成魔法伤害，总攻击力为自身的攻击力
// 请补全代码
public abstract class Hero {
    protected double attack; // 攻击力
    protected double defence; // 防御力
    protected double increase; // 增伤
    protected double power; // 法术强度

    public final double hit(Hero enemy) {

        double totalAttack = getTotalAttack();

        double enhancedAttack = enhance(totalAttack);

        double result = 0;

        // 在这里添加或者修改代码

        // 可修改部分结束


        return result;
    }

    protected abstract double getTotalAttack();

    protected abstract double enhance(double attack);

    protected double computeDefenceEffect(double attack, double defence) {
        return Math.max(0, attack - defence);
    }

    protected boolean shouldCalculateDefence() {
        return true;
    }


    public double getAttack() {
        return attack;
    }

    public void setAttack(double attack) {
        this.attack = attack;
    }

    public void setDefence(double defence) {
        this.defence = defence;
    }

    public double getDefence() {
        return defence;
    }

    public double getIncrease() {
        return increase;
    }

    public void setIncrease(double increase) {
        this.increase = increase;
    }

    public double getPower() {
        return power;
    }

    public void setPower(double power) {
        this.power = power;
    }
}
